<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich"
	template="../template/template.xhtml">

	<ui:define name="body">
	
		<f:view>
			<h:form>
			
				<h:messages style="color: red;" />
			
				<rich:panel>
					<f:facet name="header">
						<h:outputText value="Cadastrar Projeto" rendered="#{!projetoController.naoExibirCadastrar}"/>
						<h:outputText value="Alterar Projeto" rendered="#{!projetoController.naoExibirAlterar}" />
					</f:facet>
					
					<br/>
							
					<h:panelGrid columns="2">		
			            <h:outputLabel value="Nome:"/>
			            <h:inputText id="nome" value="#{projetoController.projeto.nome}" required="true" immediate="true" requiredMessage="Nome obrigatorio"/>
								
						<h:outputLabel value="Descricao:"/>
			            <h:inputTextarea id="descricao" value="#{projetoController.projeto.descricao}" rows="2" style="width: 550px;" required="true" immediate="true" requiredMessage="Descricao obrigatoria"/>
			            
						<h:outputLabel value="Data termino:"/>
			            <h:inputText id="duracao" value="#{projetoController.duracaoTemp}" required="true" immediate="true" requiredMessage="Data termino obrigatoria">
			            	<f:convertDateTime pattern="dd/MM/yyyy"/>
			            </h:inputText>
		
						<h:outputLabel value="Status:"/>
						<h:selectOneMenu id="status" value="#{projetoController.projeto.statusProjeto}" immediate="true" required="true" requiredMessage="Status obrigatorio">
							<f:selectItems value="#{projetoController.allStatus}" />
						</h:selectOneMenu>
						
						<h:outputLabel value="Perfil de Acesso:"/>
			            <h:selectOneMenu id="acesso" value="#{projetoController.projeto.perfilAcesso.perfilAcessoId}" immediate="true" required="true" requiredMessage="Perfil de Acesso obrigatorio">
							<f:selectItems value="#{projetoController.allPerfis}" />
						</h:selectOneMenu>
		            </h:panelGrid>
		
					<br/>
		            
		            <div align="center" style="width: 100%;"><h:outputText id="message" style="color: red;" value="#{projetoController.message}"/></div>
		            
		            <br/>

					<rich:separator height="2"/>

					<br/>
					
					<h:commandButton value="Cadastrar" rendered="#{!projetoController.naoExibirCadastrar}" action="#{projetoController.cadastrarProjeto}" />
		            <h:commandButton value="Alterar" rendered="#{!projetoController.naoExibirAlterar}" action="#{projetoController.cadastrarProjeto}" />
		        </rich:panel>
			</h:form>
		</f:view>	
	</ui:define>

</ui:composition>
